package com.app.ytong.bean;

import com.alibaba.fastjson.annotation.JSONField;

import java.util.ArrayList;
import java.util.List;

import my.MathUtils;

public class GoodsSubmitBean extends BaseListBean {




    private List<GoodsListData> instocks = new ArrayList<GoodsListData>();

    private List<TraceListData> traces = new ArrayList<TraceListData>();


    public List<GoodsListData> getInstocks() {
        return instocks;
    }

    public void setInstocks(List<GoodsListData> instocks) {
        this.instocks = instocks;
    }


    public List<TraceListData> getTraces() {
        return traces;
    }


    public void setTraces(List<TraceListData> traces) {
        this.traces = traces;
    }

    @JSONField(serialize = false)
    public String getCno(){
        if(instocks.size()<1)return "";
       return instocks.get(0).getCno();
    }

    @JSONField(serialize = false)
    public String getCna(){
        if(instocks.size()<1)return "";
        return instocks.get(0).getCna();
    }

    @JSONField(serialize = false)
    public String getAllTotal(){
        String total = "0";
        for (GoodsListData goodsData : instocks){
            total =  MathUtils.add(total,goodsData.getMoney());
        }
        return total;
    }

    @JSONField(serialize = false)
    public String getAllWeight(){
        String weight = "0";
        for (GoodsListData goodsData : instocks){
            weight =  MathUtils.add(weight,goodsData.getGwt());
        }
        return weight;
    }

}
